package com.metaverse.backend.utils;

import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.LinkedHashMap;
import java.util.Map;

public abstract class HttpServletUtil {

    /**
     * 获取请求头信息
     * @param request
     * @return
     */
    public static Map<String,String>  getHeaders(HttpServletRequest request){
        Enumeration<String> headerNames = request.getHeaderNames();
        Map<String,String> requestHeaders = new LinkedHashMap<>();
        while(headerNames.hasMoreElements()){
            String key = headerNames.nextElement();
            requestHeaders.put(key, request.getHeader(key));
        }

        return requestHeaders;
    }



}
